﻿/******************************************************************************
 * Copyright 2020-xxxx xxx Co., Ltd.
 * All right reserved. See COPYRIGHT for detailed Information.
 *
 * @projectName   aaa
 * @file          xcustompointline.h
 * @brief         XCustomPointLine Class
 *
 * @author        Feng<2859352492@qq.com>
 * @date          2022/03/23 11:03:08
 * @history
 *****************************************************************************/

#ifndef XCUSTOMPOINTLINES_H
#define XCUSTOMPOINTLINES_H

#include <QObject>
#include "objlib.h"
#include "basedata.h"
#include "qcustomplot.h"
#include "xnamespace.h"
#include "xcustomchartlist.h"

QT_BEGIN_NAMESPACE

using namespace xvs;

class XCustomPointLinePrivate;
class XCustomPointLine : public QCPGraph
{
public:
    explicit XCustomPointLine(QCustomPlot *parent = nullptr);
    ~XCustomPointLine();

    // getters
    //appearance
    ChartSeriesType getSeriesType() const;
    QCPScatterStyle::ScatterShape getScatterShape() const;
    Integer getScatterSize() const;
    QColor penColor() const;
    QColor brushColor() const;
    //text
    ChartValueTextPosition textPosition() const;
    double textOffset() const;
    QFont textFont() const;
    QColor textColor() const;

    // setters
    //data
    void setValue(Array &array);                            //Array内需为Integer/Real
    //appearance
    void setSeriesType(ChartSeriesType type);
    void setScatterShape(QCPScatterStyle::ScatterShape shape);
    void setScatterSize(Integer);
    void setPenColor(const QColor &color);
    void setBrushColor(const QColor &color);
    //text
    void setTextPosition(ChartValueTextPosition position);
    void setTextOffset(double offset);
    void setTextFont(const QFont &font);
    void setTextColor(const QColor &color);

protected:
    //update
    void updateDataRange();

    // reimplemented virtual methods:
    virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
    virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &scatters, const QCPScatterStyle &style) const override;

    // introduced virtual methods:
    virtual void drawValueText(QCPPainter *painter);

private:
    XCustomPointLinePrivate *XCustomPointLineP = nullptr;
};

class XCustomPointLinesPrivate;
class XCustomPointLines : public QObject
{
    Q_OBJECT
public:
    explicit XCustomPointLines(QCustomPlot *parent = nullptr);
    ~XCustomPointLines();

    // object list
    XCustomChartList<XCustomPointLine*> *pointLineList = nullptr;

    // getters
    //object

    // setters
    //object


private:
    Q_DISABLE_COPY(XCustomPointLines)
    QCustomPlot *customPointLinesParent = nullptr;
    XCustomPointLinesPrivate *XCustomPointLinesP = nullptr;
};

QT_END_NAMESPACE

#endif // XCUSTOMPOINTLINES_H
